<?php
if(!defined('APP_PATH')||!defined('DOYO_PATH')){exit('Access Denied');}
class uploads extends syController
{
	function __construct(){
		parent::__construct();
		$this->fileClass=syClass('syupload');
	}
	function index(){
		if (!empty($_FILES)){
			$fileinfos = $this->fileClass->upload_file($_FILES[$this->syArgs('isfiles',1)]);
			if (is_array($fileinfos)){
				echo '0';
					$f=explode('.',$fileinfos['fn']);
					echo ','.$fileinfos['fn'];
					echo ','.preg_replace('/.*\/.*\//si','',$f[0]);
					if(stripos($fileinfos['fn'],'jpg') || stripos($fileinfos['fn'],'gif') || stripos($fileinfos['fn'],'png') || stripos($fileinfos['fn'],'jpeg')){
						echo ',1';
					}else{
						echo ','.$f[1];
					}
			}else{
				echo $this->fileClass->errmsg;
			}
		}
	}
	function loadup(){
		$this->inputid=$this->syArgs('inputid',1);
		$this->multi=$this->syArgs('multi') ? 'true':'false';
		if($this->syArgs('fileExt',1)){$this->fileExt=$this->syArgs('fileExt',1);}else{
			foreach(explode(',',syExt('filetype')) as $v){
				$fileExt.=';*.'.$v;
			}$this->fileExt=substr($fileExt,1);
		}
		$this->sizeLimit=$this->syArgs('sizeLimit') ? $this->syArgs('sizeLimit'):syExt('filesize');
		$this->fileover=$this->syArgs('fileover') ? $this->syArgs('fileover'):1;
		$this->display("uploads.html");
	}
}